﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using DataAnnotationsExtensions;
using System.Web.Mvc;

namespace JRFinances.ViewModels.RealTransactions
{
    public class SellRealTransactionViewModel
    {
        public string CompanyName { get; set; }

        public int MaxVolume { get; set; }
       
        [Min(0)]
        public int Volume { get; set; }

        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
        public DateTime Date { get; set; }

        [Min(0.01)]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:F2}")]
        public double Price { get; set; }

        public bool CustomValidation()
        {
            if (Volume > MaxVolume)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
    }
}